package com.google.location.im.ui;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class Splash extends Canvas {

    public static int SCREEN_WIDTH, SCREEN_HEIGHT;
    private String message;
    private Image image;

    public Splash() {
        try {
            message = "Loading ..."; //[LOCALE]
            image = Image.createImage("/splash.png");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void paint(Graphics g) {
        SCREEN_WIDTH = getWidth();
        SCREEN_HEIGHT = getHeight();
        //Draw rectangle for background
        g.setColor(0X000000);
        g.fillRect(0, 0, getWidth(), getHeight());
        try {
            g.drawImage(image, getWidth() / 2, getHeight() / 2, Graphics.HCENTER | Graphics.VCENTER);
        } catch (Exception e) {
        }
        //Draw status msg
        //g.setColor(0X000000);
        //g.drawString(message, getWidth() / 2, 11 * getHeight() / 12, Graphics.HCENTER | Graphics.TOP);

    }

    public void setMess(String m) {
        this.message = m;
        repaint();
    }
}
